home *** CD-ROM | disk | FTP | other *** search
- (* FROM DEFS.INC IMPORT anystr, pathtype, tex.
- Cant(fname:pathtype) ;
- ShortName(name : pathtype) :integer ;
- ExtPos(name) : integer ;
- NewFname( old, ext : pathtype ; mode : char ('+-')) : pathtype ;
- FileExist(name: pathtype): Boolean;
- *)
- procedure Cant(fname : pathtype) ;
- begin
- WriteLn('Cannot open file [', fname, '].') ;
- end ; {Cant}
-
- procedure CantHalt(fname: pathtype);
- begin
- Cant(fname); Halt(1)
- end {CantHalt};
-
- function ShortName(name : pathtype) :integer ;
- var i,p : integer ;
- begin
- i := 1 ; p := 0 ;
- while i <= length(name) do begin
- case name[i] of
- ':','\' : p := i ; { rev. 88/4/28 }
- #$81..#$9f,#$E0..#$FC : i := i + 1 ;
- end ;
- i := i + 1
- end ;
- ShortName := p + 1
- end ; {ShortName}
-
- function ExtPos( name : pathtype) : integer ;
- var i,p : integer ;
- begin
- i := 1 ; p := 0 ;
- while i <= length(name) do begin
- case name[i] of
- '.' : p := i ;
- '\' : p := 0 ;
- #$81..#$9f,#$E0..#$FC : i := i + 1 ;
- end ;
- i := i + 1
- end ;
- ExtPos := p
- end ; {ExtPos}
-
- function NewFname( old, ext : pathtype ; mode : char) : pathtype ;
- var p : integer ;
- begin
- p := ExtPos(old);
- case mode of
- '+' :
- if p = 0 then NewFname := old + '.' + ext
- else NewFname := old ;
- '-' :
- if p = 0 then NewFname := old + '.' + ext
- else NewFname := Copy(old,1,p) + ext ;
- end ;
- end ; {NewFname}
-
- function FileExist(name:pathtype):Boolean;
- var f:file;
- begin Assign(f,name);
- {$i-} Reset(f); {$i+}
- if IOresult = 0 then begin
- Close(f); FileExist := true
- end
- else FileExist := false
- end ;